package cn.zmwh.manage.api.modules.tools.controller;


import cn.zmwh.common.core.api.Result;
import cn.zmwh.manage.api.modules.tools.entity.request.SendCodeRequest;
import cn.zmwh.manage.api.modules.tools.service.CodeSendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author dmzmwh
 * @since 2024-08-26
 */
@Slf4j
@Api(tags = "用户相关")
@RestController
@RequestMapping
public class CodeSendController {

    @Autowired
    CodeSendService codeSendService;


    @GetMapping("/user/code")
    @ApiImplicitParams(
            {
                    @ApiImplicitParam(name = "mobile", value = "手机"),
                    @ApiImplicitParam(name = "email", value = "邮箱"),
                    @ApiImplicitParam(name = "type", value = "验证码类型，登录：login 注册register 找回密码 password"),
                    @ApiImplicitParam(name = "origin", value = "origin"),
            }
    )
    @ApiOperation(value = "发送验证码 ")
    public Result sendCode(SendCodeRequest req) {

        return codeSendService.sendCode(req);
    }

}

